<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">小程序列表</div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-sm">
                                    <a class="am-btn am-btn-primary am-radius" href="{:url('applet/add')}">
                                        <span class="am-icon-plus"></span> 创建
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-hover tpl-table-black">
                            <thead>
                            <tr>
                                <th>Applet_Id</th>
                                <th>小程序头像</th>
                                <th>小程序名称</th>
                                <th>版本类型</th>
                                <th>注册来源</th>
                                <th>是否授权</th>
                                <th>到期时间</th>
                                <th>创建时间</th>
                                <th>管理操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if !$list->isEmpty()}
                                {foreach $list as $item}
                                <tr>
                                    <td class="am-text-middle">{$item['applet_id']}</td>
                                    <td class="am-text-middle">
                                        <img src="{$item['head_img']}" width="50" height="50" alt="小程序图片">
                                    </td>
                                    <td class="am-text-middle">
                                        <p class="item-title">{$item['app_name']|default='--'}</p>
                                    </td>
                                    <td class="am-text-middle">
                                        {$item['template']['name']}
                                        <span style="position:absolute;margin-top:-10px;" class="am-badge am-round 
                                        {$item['shop_mode']['value'] == 10? 'am-badge-secondary':'am-badge-success'}">
                                        {$item['shop_mode']['text']}
                                        </span>
                                    </td>
                                    <td class="am-text-middle">{$item['source']['text']}</td>
                                    <td class="am-text-middle">{$item['status']['text']}</td>
                                    <td class="am-text-middle">剩余{$item['expire_time']['day']}天</td>
                                    <td class="am-text-middle">{$item['create_time']}</td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="{:url('applet/setup',['id' => $item['applet_id']])}" target="_blank" 
                                                class="tpl-table-black-operation-primary">
                                                <i class="am-icon-cog"></i> 设置
                                            </a>
                                            <a href="{:url('applet/login',['id' => $item['applet_id']])}" target="_blank">
                                                <i class="am-icon-desktop"></i> 登录
                                            </a>
                                            <a href="{:url('applet/status',['id' => $item['applet_id']])}" 
                                                class="item-delete tpl-table-black-operation-green" >
                                                <i class="am-icon-credit-card"></i> 续费
                                            </a>
                                            {if $item['status']['value'] == 0}
                                            <a href="javascript:;" class="item-del tpl-table-black-operation-del"
                                               data-id="{$item['applet_id']}">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                            {/if}
                                        </div>
                                    </td>
                                </tr>
                                {/foreach}
                            {else /}
                                <tr>
                                    <td colspan="9" class="am-text-center">暂无记录</td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr">{:$list->render()} </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：{:$list->total()}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        // 删除元素
        $('.item-del').del('id', "{:url('applet/delete')}",'确定要删除吗？删除后相关数据将无法恢复！');

    });
</script>